package com.study.service.impl;

import com.study.bean.Ds;
import com.study.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @创建时间 2020/4/21 11:16
 */
@Service
@Transactional
public class TestServiceImpl implements TestService {
    @Autowired
    JdbcTemplate jdbcTemplate;

    @Override
    public void add() {
        Date date = new Date();
        Ds ds = new Ds().setDate(date).setDatetime(date).setTime(date).setTimestamp(date);
        jdbcTemplate.update("insert into ds(date,time,datetime,timestamp) values(?,?,?,?)", new Object[]{date, date, date, date});
        int i = 1 / 0;
    }
}
